
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

public class ActivityManagement extends AppCompatActivity {
    private List<ActivityInfo> mActivityList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_event_list);

        // 初始化默认活动数据（参考之前的代码）
        initDefaultActivities();

        // 配置 RecyclerView 和适配器
        RecyclerView recyclerView = findViewById(R.id.rv_events);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        ActivityAdapter adapter = new ActivityAdapter(mActivityList);
        recyclerView.setAdapter(adapter);

        Log.d("测试", "活动数量: " + mActivityList.size());
    }

    // 初始化默认活动数据的方法
    private void initDefaultActivities() {
        mActivityList = new ArrayList<>();
        // 这里添加你需要的默认活动数据，示例：
        mActivityList.add(new ActivityInfo("E001", "英雄联盟城市挑战赛", "2023-12-15", "上海市电竞中心", 128, "电竞比赛", "腾讯游戏"));
        mActivityList.add(new ActivityInfo("E002", "原神线下漫展", "2025-10-01", "上海国家会展中心", 500, "漫展", "米哈游"));
        mActivityList.add(new ActivityInfo("E003", "王者荣耀水友赛", "2024-05-20", "北京工人体育馆", 200, "电竞", "腾讯游戏"));
        Log.d("ActivityManagement", "默认活动数量: " + mActivityList.size());
    }
}